package com.link2room.ironhide.controller.manager;

import com.link2room.common.dto.param.base.BaseParamDto;
import com.link2room.common.dto.result.base.BaseResultDto;
import com.link2room.common.jpa.result.QueryResult;
import com.link2room.ironhide.dto.result.base.L2RGroupRoomtypeDto;
import com.link2room.ironhide.facade.IGroupRoomtypeFacadeService;
import com.link2room.sideswipe.permissionResouces.annotation.L2RPermissionResources;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

import static com.link2room.ironhide.constant.PermissionConstant.groupRoomtypes;

/**
 * Created by sss on 2016/8/29.
 */
@Api(tags = "集团房型管理")
@RestController
@RequestMapping("/manager/GroupRoomtypes")
public class GroupRoomtypeManagerController {
    @Resource
    private IGroupRoomtypeFacadeService groupRoomtypeFacadeService;

    @ApiOperation(value="获取集团房型列表",response = L2RGroupRoomtypeDto.class)
    @RequestMapping(method= RequestMethod.GET)
    @L2RPermissionResources(value = groupRoomtypes,name = "获取集团房型列表")
    public @ResponseBody BaseResultDto groupRoomtypeList(
    ) throws Exception {
        BaseParamDto baseParamDto =new BaseParamDto();
        QueryResult<L2RGroupRoomtypeDto> groupRoomtypeResult = groupRoomtypeFacadeService.listGroupRoomType(baseParamDto);
        BaseResultDto l2rRs=new BaseResultDto();
        l2rRs.setResultCode(0);
        l2rRs.setQueryResult(groupRoomtypeResult);
        return l2rRs;
    }

    @ApiOperation(value="获取集团房型待创建列表",response = L2RGroupRoomtypeDto.class)
    @RequestMapping(value = "/GroupRoomtypesNotCreated",method= RequestMethod.GET)
    public @ResponseBody BaseResultDto groupRoomtypeNotCreatedList(
            @RequestParam(value = "lhotelCode", required = false) String lhotelCode
    ) throws Exception {
        BaseParamDto baseParamDto =new BaseParamDto();
        baseParamDto.setLhotelCode(lhotelCode);
        List<L2RGroupRoomtypeDto> roomtypeList = groupRoomtypeFacadeService.listGroupRoomTypeNotCreated(baseParamDto);
        BaseResultDto l2rRs=new BaseResultDto();
        l2rRs.setResultCode(0);
        l2rRs.setListToQueryResult(roomtypeList);
        return l2rRs;
    }
}
